﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Wage.aspx.cs" Inherits="Admin_Wage" %>

<!DOCTYPE html>
<script runat="server">
</script>


<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <title>管理工资</title>
	<script src="../JavaScript/time.js">
	    
	</script>
    <style type="text/css">
        .style1
        {
            width: 100%;
        }
        .style2
        {
            width: 304px;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <!--<div style="width: 130px; margin-top: 200px; margin-left: 300px; background-color: #FF0000;">
    
        Welcome to here!

    </div>-->
    <div>
         <table>
            <tr>
                <td>
                    <asp:Label ID="lblSeach" runat="server" Text="搜索"></asp:Label>
                    <asp:TextBox ID="txtSeach" runat="server"></asp:TextBox>
                    <asp:Button ID="btnSeacrh" runat="server" OnClick="btnSeacrh_Click" Text="确定" />
                </td>
            </tr>
             <tr>
                <td>
                    <asp:Button ID="btnGEmployee" runat="server" Text="管理员工" OnClick="btnGEmployee_Click" />
                    <asp:Button ID="btnGUser" runat="server" Text="管理用户" OnClick="btnGUser_Click" />
                    <asp:Button ID="btnCalWage" runat="server" OnClick="btnCalWage_Click" Text="计算工资" />
                </td>
            </tr>
        </table>

        <table class="style1">
            <tr>
                <td class="style2">
                    <asp:GridView ID="GridView1" runat="server" AllowPaging="True" AutoGenerateColumns="False"
                        DataKeyNames="w_Id" DataSourceID="SqlDataSource1">
                        <Columns>
                            <asp:BoundField DataField="w_Id" HeaderText="工资Id" InsertVisible="False"
                                ReadOnly="True" SortExpression="u_Id" />
                            <asp:BoundField DataField="e_Id" HeaderText="员工Id" SortExpression="w_Bw" />
                            <asp:CommandField HeaderText="详细资料" SelectText="详细资料" ShowSelectButton="True" />
                        </Columns>
                    </asp:GridView>
                </td>
                <td>
                    <asp:DetailsView ID="DetailsView1" runat="server" AllowPaging="True" AutoGenerateRows="False"
                        DataKeyNames="w_Id" DataSourceID="SqlDataSource2" Height="50px" OnItemDeleted="DetailsView1_ItemDeleted"
                        OnItemInserted="DetailsView1_ItemInserted" Width="125px">
                        <Fields>
                            <asp:BoundField DataField="w_Id" HeaderText="工资Id" InsertVisible="true"
                                ReadOnly="True" SortExpression="w_Id" />
                            <asp:BoundField DataField="e_Id" HeaderText="员工Id" SortExpression="w_Bw" />
                            <asp:BoundField DataField="d_Id" HeaderText="职务编号" SortExpression="d_Id" />
                            <asp:BoundField DataField="w_Bw" HeaderText="基本工资" SortExpression="w_Bw" />
                            <asp:BoundField DataField="w_Gw" HeaderText="总工资" SortExpression="w_Gw" />
                            <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" ShowInsertButton="True" />
                        </Fields>
                        <HeaderTemplate>
                            详细资料
                        </HeaderTemplate>
                    </asp:DetailsView>
                </td>
            </tr>
        </table>
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:pmsConnectionString %>"
            SelectCommand="SELECT * FROM [Wage]"></asp:SqlDataSource>
        <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:pmsConnectionString %>"
            DeleteCommand="DELETE FROM [Wage] WHERE [w_Id] = @w_Id" InsertCommand="INSERT INTO [Wage] ( [w_Id],[w_Bw],[d_Id], [w_Gw], [e_Id]) VALUES (@w_Id, @w_Bw, @d_Id, @w_Gw, @e_Id)"       
            SelectCommand="SELECT * FROM [Wage] WHERE ([w_Id] = @w_Id)" UpdateCommand="UPDATE [Wage] SET [w_Id] = @w_Id, [w_Bw] = @w_Bw, [d_Id] = @d_Id, [w_Gw] = @w_Gw, [e_Id] = @e_Id WHERE [w_Id] = @w_Id">
            <SelectParameters>
                <asp:ControlParameter ControlID="GridView1" Name="w_Id" PropertyName="SelectedValue"
                    Type="String" />
            </SelectParameters>
            <DeleteParameters>
                <asp:Parameter Name="w_Id" Type="String" />
            </DeleteParameters>
            <UpdateParameters>        
                <asp:Parameter Name="w_Id" Type="String" />
                <asp:Parameter Name="w_Bw" Type="String" />
                <asp:Parameter Name="d_Id" Type="String" />
                <asp:Parameter Name="w_Gw" Type="String" />
                <asp:Parameter Name="e_Id" Type="String" />
            </UpdateParameters>
            <InsertParameters>
                <asp:Parameter Name="w_Id" Type="String" />
                <asp:Parameter Name="w_Bw" Type="String" />
                <asp:Parameter Name="d_Id" Type="String" />
                <asp:Parameter Name="w_Gw" Type="String" />
                <asp:Parameter Name="e_Id" Type="String" />
            </InsertParameters>
        </asp:SqlDataSource>
        
    </div>
    </form>
</body>
</html>
